#include "plook_u8s16_bincka.h"
#include "binsearch_u8s16.h"
#include "rtwtypes.h"

uint8_T plook_u8s16_bincka(int16_T u, const int16_T bp[], uint32_T maxIndex)
{
  uint8_T bpIndex;
  if (u <= bp[0U]) {
    bpIndex = 0U;
  } else if (u < bp[maxIndex]) {
    bpIndex = binsearch_u8s16(u, bp, maxIndex >> 1U, maxIndex);
  } else {
    bpIndex = (uint8_T)maxIndex;
  }

  return bpIndex;
}
